const { expect } = require("chai");

describe("Token contract", function () {
  let token;
  let owner, addr1, addr2;

  beforeEach(async function () {
    const Token = await hre.ethers.getContractFactory("Token");
    [owner, addr1, addr2] = await ethers.getSigners();

    token = await Token.deploy("TEST", "TEST", 18, "100000000000000000000000");
    await token.deployed();
  });

  describe("Deployment", function () {
    it("Should set the right owner", async function () {
      expect(await token.hasRole(await token.MINTER_ROLE(), await owner.getAddress()));
      expect(await token.hasRole(await token.PAUSER_ROLE(), await owner.getAddress()));
    });

    it("Should assign the total supply of tokens to the owner", async function () {
      const ownerBalance = await token.balanceOf(await owner.getAddress());
      expect(await token.totalSupply()).to.equal(ownerBalance);
    });
  });
});
